/**
 * 
 */
package data.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import data.TreeViewElement;

/**
 * Wrapper-Klasse zur Verwendung von {@link ProjectsCollection} in jFace
 * TreeViewer
 * 

 */
public class OverviewProjectsCollection extends AbstractModel implements
		Serializable, TreeViewElement {
	private static final long serialVersionUID = -275438491795337818L;

	private final ProjectsCollection projectsCollection;

	/**
	 * @param projectsCollection
	 */
	public OverviewProjectsCollection(ProjectsCollection projectsCollection) {
		super();
		if (projectsCollection == null) {
			throw new IllegalArgumentException(
					"projectsCollection must not be null");
		}
		this.projectsCollection = projectsCollection;
	}

	@Override
	public String getText() {
		return "Overview";
	}

	public ProjectsCollection getProjectsCollection() {
		return projectsCollection;
	}

	public List<Project> getProjects() {
		return new ArrayList<Project>(projectsCollection.values());
	}

	@Override
	public Collection<? extends TreeViewElement> getChildren() {
		return getProjects();
	}

}
